<?php

Class Administrador extends CI_Controller{

	function index(){

		if ($this->session->userdata('logged_in') != false) {
			$user = $this->session->userdata('logged_in');
			$data['user'] = $this->session->userdata('logged_in');
			$this->load->view('header-admin',$data);
			$this->load->view('barra-logeado',$data);
			$this->load->view('admin-index',$data);
			if ($user['tipo_user']=="Administrador General") {
				$this->load->view('nav-admin-general');
			}elseif ($user['tipo_user']=="Administrador de Sede") {
				$this->load->view('nav-admin-sede');
			}elseif ($user['tipo_user']=="Operador") {
				$this->load->view('nav-operador');
			}
			$this->load->view('admin-index-continue',$data);

		}else{
			$data['error'] = "";			
			$this->load->view('login-form',$data);
		}
	}

	function logout(){
		$this->session->unset_userdata('logged_in');
		session_start();
		session_destroy();
		redirect('administrador','refresh');
	}	
}